package com.xxxx.server.exception;

import com.xxxx.server.pojo.RespBean;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 全局异常处理
 */
@ControllerAdvice
public class GlobalEx {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public RespBean MyEx(Exception e){

        e.printStackTrace();
        return RespBean.error(e.getMessage());
    }
}
